import { createApp } from "vue";
import naive from "naive-ui";
import { createPinia } from "pinia";
import { createDiscreteApi, lightTheme } from "naive-ui";
import naiveplus from "components/index";
import App from "./App.vue";
import router from "./routes";
import "./assets/styles/style.css";

const app = createApp(App);
const store = createPinia();
app.use(store);
app.use(naive);
app.use(naiveplus);
app.use(router);

function setupNaiveDiscreteApi() {
  const { message, dialog, notification, loadingBar, modal } =
    createDiscreteApi(
      ["message", "dialog", "notification", "loadingBar", "modal"],
      {
        configProviderProps: {
          theme: lightTheme,
        },
      },
    );
  window.$dialog = dialog;
  window.$loading = loadingBar;
  window.$message = message;
  window.$notification = notification;
  window.$modal = modal;
}
setupNaiveDiscreteApi();

app.mount("#app");
